<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增经销商</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
		<div tabid="tabA" title="基本信息" lselected="true">
	            <form id="formSet1">
	                <div class="fieldset1 tabel_col clearFix">
	                    <!-- 自然人经销商 -->
						<c:if test="${splAttrCd == 1}">
							<div class="caption">
		                        <span class="title">基本信息</span>
		                        <input name="splAttrCd" id="splAttrCd" type="hidden" class="ui-textbox" value="${splAttrCd }">
		                    </div>
							<div class="fieldBox col_33">
								<div class="label">姓名</div>
								<div class="field">
									<input name="splNm" id="splNm" type="text" class="ui-textbox" value="${splNm }" validate="{required:true}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">身份证号</div>
								<div class="field">
									<input name="succ" id="succ" type="text"
										class="ui-textbox" value="${succ }"
										validate="{required:true}"> <span
										class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33" <c:if test="${currBuOrgCd != '00000005' }">style="display: none"</c:if>>
								<div class="label">经销商类型</div>
								<div class="field">
									<select name="prjLvlCd" id="prjLvlCd" data-value=" "
										<c:if test="${currBuOrgCd == '00000005' }">validate ="{required:true,select:true}"</c:if>>
										<option value=" " checked>请选择</option>
										<c:forEach items="${prjLvlCdList }" var="mfr">
											<option value="${mfr.key }">${mfr.value }</option>
										</c:forEach>
									</select>
									<c:if test="${currBuOrgCd == '00000005' }">
										<span id="prjLvlCdSpan" class="requiredSymbol">*</span>
									</c:if>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">联系电话</div>
								<div class="field">
									<input name="splTel" id="splTel" type="text" class="ui-textbox"
										value="" validate="{required:true,mobileAndFixedPhone:true}" >
										<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">户口所在地</div>
								<div class="field" style="width: 100%;">
									<input name="regAddr" id="regAddr" type="text"
										class="ui-textbox" value="">
										<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">通讯地址</div>
								<div class="field" style="width: 100%;">
									<input name="postAddr" id="postAddr" type="text"
										class="ui-textbox" value="">
										<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">邮编</div>
								<div class="field">
									<input name="zipNo" id="zipNo" type="text" class="ui-textbox"
										value="">
								</div>
							</div>
							<div class="fieldBox col_66_auto">
								<div class="label">区域</div>
								<div class="field">
									<!-- <input name="rgnPrCd" id="rgnPrCd" type="text" class="ui-textbox" value=""> -->
									<jsp:include page="../../system/sysRegion/region.jsp"
										flush="true">
										<jsp:param name="regionShowLvl" value="2" />
									</jsp:include>
									<span class="requiredSymbol">*</span>
								</div>
							</div>

							<div class="caption">
                        		<span class="title">更多信息</span>
                    		</div>
							<div class="fieldBox col_33">
								<div class="label">项目类型</div>
								<div class="field">
									<input name="prjTypCds" id="prjTypCds" type="text"
										ltype="combobox">
								</div>
							</div>
							<div class="fieldBox col_33" style="display: none">
								<div class="label">所属事业部</div>
								<div class="field">
									<input type="text" id="buOrgCds" name="buOrgCds"
										onchange="buOrgCdChange();"
										ltype="combobox" /> <span class="requiredSymbol">*</span>
								</div>
							</div>
							<!-- 专车新增 begin -->
							<c:if test="${currentBuOrgCd != null and currentBuOrgCd == '00000008'}">
							<div class="fieldBox col_33">
								<div class="label">经销商类别（专车）</div>
								<%--<div class="field">--%>
									<%--<input type="text" id="splTypCd" name="splTypCd" onchange="splTypCdChange();"--%>
										   <%--ltype="combobox" />--%>
								<%--</div>--%>
								<div class="field">
									<select name="splTypCd" id="splTypCd" data-value="${splTypCd }">
										<option value="" selected="selected">请选择</option>
										<c:forEach items="${searchSplTypCdList}" var="stc">
											<option value="${stc.key}">${stc.value }</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">合作开始时间（专车）</div>
								<div class="field">
									<input type="text" id="coopDt" name="coopDt" class="ui-datepicker" value="" validate="{required:true}"/>
								</div>
							</div>
							<%--<div id="zk" style="display: none">--%>
							<div class="fieldBox col_33" id = "zk_01" style="display: none">
								<div class="label">代理商协议乙方</div>
								<div class="field">
									<input type="text" id="agtSec" name="agtSec"  value="" validate="{required:true}"/>
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_02" style="display: none">
								<div class="label">代理商协议丙方</div>
								<div class="field">
									<input type="text" id="agtThd" name="agtThd"  value="" validate="{required:true}" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_03" style="display: none">
								<div class="label">代理商基础任务量</div>
								<div class="field">
									<input type="text" id="bscTaskQty" name="bscTaskQty"  value="" validate="{number:true}" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_04" style="display: none">
								<div class="label">代理商入网保证金</div>
								<div class="field">
									<input type="text" id="entDepAmt" name="entDepAmt"  value="" validate="{number:true}" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_05" style="display: none">
								<div class="label">我司提供车辆最高总价值</div>
								<div class="field">
									<input type="text" id="prdMaxValAmt" name="prdMaxValAmt"  value="" validate="{number:true}" />
								</div>
							</div>
							<%--</div>--%>
							</c:if>
							<!-- 专车新增 end-->
							<!-- <div class="fieldBox col_33">
			                    <div class="label">经营类型(新车)</div>
			                    <div class="field">
			                    	<input type="text" id="newCarTyp" name="newCarTyp" ltype="combobox" validate="{required:false}"/>

			                    	<span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">经营类型(二手车)</div>
			                    <div class="field">
			                    	<input type="text" id="usedCarTyp" name="usedCarTyp" ltype="combobox" validate="{required:false}"/>
			                    	<span class="requiredSymbol">*</span>
			                    </div>
			                </div> -->
							<div class="fieldBox col_33">
								<div class="label">经销品牌(卡车类)</div>
								<div class="field">
									<input type="text" id="tkBrCd" name="tkBrCd" ltype="combobox"
										validate="{required:false}" />
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">经销品牌(乘用车类)</div>
								<div class="field">
									<input type="text" id="carBrCd" name="carBrCd" ltype="combobox"
										validate="{required:false}" />
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">经销品牌(客车类)</div>
								<div class="field">
									<input type="text" id="busBrCd" name="busBrCd" ltype="combobox"
										validate="{required:false}" />
								</div>
							</div>
							<div class="fieldBox col_100_auto">
								<div class="label">经销商所属厂商</div>
								<div class="field">
									<input name="mfrIds" id="mfrIds" type="text" value=""
										placeholder="请选择" ltype="combobox">
								</div>
							</div>
							<div class="fieldBox col_100_auto">
			                    <div class="label">所属交易市场</div>
			                    <div class="field">
			                        <input name="atcIdNm" id="atcIdNm" type="text" value="" class="ui-textbox" placeholder="请选择" >
			                    </div>
			                </div>
			                <input type="hidden"  id="atcId" name="atcId"  class="ui-textbox" value="">
							<!-- <div class="fieldBox col_33">
								<div class="label">经销商返利比例%</div>
								<div class="field" style="width: 100%;">
									<input name="rebPct" id="rebPct" type="text" class="ui-textbox" value="" validate ="{number:true}" disabled="disabled">
								</div>
							</div> -->
							<!-- add by zhaoyong 20170829 begin -->
							<!-- <div class="fieldBox col_33">
			                    <div class="label">是否有权查询征信</div>
			                    <div class="field">
		                            <input id="isAuthCrdChkYes" type="radio" value="1" name="isAuthCrdChk" /> 是
		                            <input id="isAuthCrdChkNo" type="radio" value="0" name="isAuthCrdChk" /> 否
		                        </div>
			                </div>
							<div class="fieldBox col_33">
								<div class="label">每日可查询征信次数</div>
								<div class="field" style="width: 100%;">
									<input name="limChkTms" id="limChkTms" type="text" class="ui-textbox" value="" validate ="{number:true,required:true}">
								</div>
							</div> -->
							<!-- add by zhaoyong 20170829 end -->
							<div class="fieldBox col_100">
								<div class="label">其他信息</div>
								<div class="field" style="width: 100%;">
									<textarea name="othInfoCd" id="othInfoCd" rows="4"
										class="l-textarea" style="width: 99%" value=""></textarea>
								</div>
							</div>
							<c:if test="${isShowAuditBtn==1 }">
					            <div class="caption">
					            	<span class="title">资料信息</span>
					        	</div>
					        	<div class="fieldBox col_100">
									<div id="fileList">
										<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecListDetail.jsp" flush="true" >
											<jsp:param name="pkId" value="${id }"/>
											<jsp:param name="tabNm" value="SPL_BSC_INFO"/>
										</jsp:include>
									</div>
								</div>
							</c:if>
						</div>
						<div class="sqPanel">
			                <div class="sqPanel_head inL">
			                    <div class="btnsBox inLC">
			                    	<span id="spl_rl_add_btn" class="sq-button sq-button-round" onclick="splNpSocialRlAddBtnEvent();">添加</span>
			                    	<span id="spl_rl_mdf_btn" class="sq-button sq-button-round" onclick="splNpSocialRlModifyBtnEvent();">修改</span>
			                    </div>
			                    <span>社会关系/家庭成员</span>
			                </div>
			                <div class="sqPanel_body">
			                    <div id="ligergrid_np_rl_psn" class="sq-grid"></div>
			                </div>
			            </div>
						</c:if>

						<!-- ======= 法人经销商 ==========-->
						<c:if test="${splAttrCd != 1}">
							<div class="caption">
		                        <span class="title">基本信息</span>
		                        <!-- <span name="readBtn" id="readBtn" class="sq-button sq-button-round">一键读取企业信息</span> -->
		                        <%-- <c:if test="${sign !=2 }">
		                        	<input type = "button" name="readBtn" id="readBtn" class="sq-button sq-button-round" value="一键读取企业信息"/>
		                        </c:if> --%>
		                        <input name="splAttrCd" id="splAttrCd" type="hidden" class="ui-textbox" value="${splAttrCd }" />
		                    </div>
		                    <div class="fieldBox col_33">
			                    <div class="label">经销商名称</div>
			                    <div class="field">
			                        <input name="splNm" id="splNm" type="text" class="ui-textbox" value="${splNm }"
			                        	<c:if test="${isSplNmModify == 0 }">disabled="disabled"</c:if>
			                         validate="{required:true}" >
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <%-- <div class="fieldBox col_33">
			                    <div class="label">营业执照号</div>
			                    <div class="field">
			                        <input name="bizLicNo" id="bizLicNo" type="text" class="ui-textbox" value="${bizLicNo }" validate="{required:true}" >
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
		                    <div class="fieldBox col_33">
			                    <div class="label">税务登记号</div>
			                    <div class="field">
			                        <input name="taxRegNo" id="taxRegNo" type="text" class="ui-textbox" value="${bizLicNo }" validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">组织机构代码号</div>
			                    <div class="field">
			                        <input name="orgCode" id="orgCode" type="text" class="ui-textbox" value="${bizLicNo }" validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div> --%>

			                <div class="fieldBox col_33">
			                    <div class="label">统一社会信用代码</div>
			                    <div class="field">
			                        <input name="succ" id="succ"  type="text" class="ui-textbox" value="${succ }" validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33"
			                <c:if test="${currBuOrgCd != '00000005' }">style="display: none"</c:if>>
			                    <div class="label">经销商类型</div>
			                    <div class="field">
			                        <select name="prjLvlCd" id="prjLvlCd" data-value=" "
			                        	<c:if test="${currBuOrgCd == '00000005' }">validate ="{required:true,select:true}"</c:if>>
			                        	<option value=" " checked >请选择</option>
										<c:forEach items="${prjLvlCdList }" var="mfr">
										    <option value="${mfr.key }">${mfr.value }</option>
										</c:forEach>
									</select>
									<c:if test="${currBuOrgCd == '00000005' }">
				                        <span id="prjLvlCdSpan" class="requiredSymbol">*</span>
									</c:if>
			                    </div>
			                </div>
			                 <div class="fieldBox col_33"<c:if test="${currBuOrgCd != '00000001' }">style="display: none"</c:if>>
			                    <div class="label">经销商级别</div>
			                    <div class="field">
			                        <select name="splLvlCd" id="splLvlCd" data-value=" "
			                        	<c:if test="${currBuOrgCd == '00000001' }">validate ="{required:true,select:true}"</c:if>>
			                        	<option value=" " checked >请选择</option>
										<c:forEach items="${splLvlCdList }" var="mfr">
										    <option value="${mfr.key }">${mfr.value }</option>
										</c:forEach>
									</select>
									<c:if test="${currBuOrgCd == '00000001' }">
										<span id="splLvlCdSpan" class="requiredSymbol">*</span>
									</c:if>
			                    </div>
			                </div>

		                    <!-- <div class="fieldBox col_33">
			                    <div class="label">注册电话</div>
			                    <div class="field">
			                        <input name="splTel" id="splTel" type="text" class="ui-textbox" value="" validate="{mobileAndFixedPhone:true}">
			                    </div>
			                </div> -->
		                    <!-- <div class="fieldBox col_33">
			                    <div class="label">经销商传真</div>
			                    <div class="field">
			                        <input name="splFax" id="splFax" type="text" class="ui-textbox" value="" >
			                    </div>
			                </div> -->
		                    <%-- <div class="fieldBox col_33">
			                    <div class="label">企业性质</div>
			                    <div class="field">
			                        <select name="corpTypCd" id="corpTypCd" data-value=" ">
			                        	<option value=" " checked >请选择</option>
										<c:forEach items="${corpTypCdList }" var="mfr">
										    <option value="${mfr.key }">${mfr.value }</option>
										</c:forEach>
									</select>
			                    </div>
			                </div> --%>
			                <div class="fieldBox col_33">
			                    <div class="label">成立日期</div>
			                    <div class="field">
			                        <input name="regDt" id="regDt" type="text" class="ui-datepicker" value=""  validate="{required:true}">
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">有效日期</div>
			                    <div class="field">
			                        <input name="expDt" id="expDt" type="text" class="ui-datepicker" value="">
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">注册资本</div>
			                    <div class="field">
			                        <input name="regCapAmt" id="regCapAmt" type="text" class="ui-textbox" ligerui="width: 110"  value="" validate="{number:true}">
			                        <select name="regCapUntCd" id="regCapUntCd" ligerui="width: 60" data-value="">
										<c:forEach items="${capUntCdList }" var="kv" begin="0" step="1" varStatus="status">
											<c:if test="${status.index == 0}">
										    	<option value="${kv.key }" checked >${kv.value }</option>
											</c:if>
										    <c:if test="${status.index != 0}">
										    	<option value="${kv.key }">${kv.value }</option>
										 	</c:if>
										</c:forEach>
									</select>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">实收资本</div>
			                    <div class="field">
			                        <input name="paidCapAmt" id="paidCapAmt" type="text" class="ui-textbox"  ligerui="width: 110" value="" validate="{number:true}">
			                        <select name="paidCapUntCd" id="paidCapUntCd" ligerui="width: 60" data-value="">
										<c:forEach items="${capUntCdList }" var="kv" begin="0" step="1" varStatus="status">
											<c:if test="${status.index == 0}">
										    	<option value="${kv.key }" checked >${kv.value }</option>
											</c:if>
										    <c:if test="${status.index != 0}">
										    	<option value="${kv.key }">${kv.value }</option>
										 	</c:if>
										</c:forEach>
									</select>
			                    </div>
			                </div>
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">是否回购</div>
			                    <div class="field">
		                            <input id="yesRadio" type="radio" value="1" name="isBuyBack" /> 是
		                            <input id="noRadio" type="radio" value="0" name="isBuyBack" /> 否
		                        </div>
			                </div> -->
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">经营范围</div>
			                    <div class="field">
			                        <input name="bizScope" id="bizScope" type="text" class="ui-textbox" value="" >
			                    </div>
			                </div> -->

			                <div class="fieldBox col_33">
			                    <div class="label">经营范围</div>
			                    <div class="field">
			                    	<input type="text" id="bizScope"  name="bizScope"  ltype="combobox" validate="{required:false}"/>

			                    </div>
			                </div>

			                <div class="fieldBox col_33">
			                    <div class="label">注册地址</div>
			                    <div class="field">
			                        <input name="regAddr" id="regAddr"  type="text" class="ui-textbox" value="" >
			                    </div>
			                </div>
							<div class="fieldBox col_33">
								<div class="label">公司归属</div>
								<div class="field">
									<select name="ownerCd" id="ownerCd" data-value=" ">
										<option value=" " checked >请选择</option>
										<c:forEach items="${ownerKVList }" var="owner">
											<option value="${owner.key }">${owner.value }</option>
										</c:forEach>
									</select>
								</div>
							</div>
			                <div class="fieldBox col_66_auto">
			                    <div class="label">区域</div>
			                    <div class="field">
			                        <!-- <input name="rgnPrCd" id="rgnPrCd" type="text" class="ui-textbox" value=""> -->
			                        <jsp:include page="../../system/sysRegion/region.jsp" flush="true" >
										<jsp:param name="regionShowLvl" value="2"/>
									</jsp:include>
									<span class="requiredSymbol">*</span>
			                    </div>
			                </div>

			                <!-- <div class="fieldBox col_33">
			                    <div class="label">供销商网址</div>
			                    <div class="field">
			                        <input name="websit" id="websit" type="text" class="ui-textbox"  value="" >
			                    </div>
			                </div> -->

			                <!-- <div class="fieldBox col_33">
			                    <div class="label">档案协议编号</div>
			                    <div class="field">
			                        <input name="fileNo" id="fileNo" type="text" class="ui-textbox" value="假数据..." validate="{required:true}" disabled>
			                        <span class="requiredSymbol">*</span>
			                    </div>
			                </div> -->

			                <div class="fieldBox col_33">
			                    <div class="label">办公地址</div>
			                    <div class="field" style="width: 100%;">
			                        <input name="postAddr" id="postAddr" type="text" class="ui-textbox" value="" >
			                    </div>
			                </div>
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">企业邮编</div>
			                    <div class="field" style="width: 100%;">
			                        <input name="zipNo" id="zipNo" type="text" class="ui-textbox" value="" >
			                    </div>
			                </div> -->
			                <div class="caption">
                        		<span class="title">更多信息</span>
                    		</div>
			                <div class="fieldBox col_100">
			                    <div class="label">项目类型</div>
			                    <div class="field">
			                        <input name="prjTypCds" id="prjTypCds" type="text" ltype="combobox">
			                    </div>
			                </div>
			                <div class="fieldBox col_100" style="display: none">
			                    <div class="label">所属事业部</div>
			                    <div class="field">
			                    	<input type="text" id="buOrgCds" name="buOrgCds" onchange="buOrgCdChange();" ltype="combobox"/>
			                    	<span class="requiredSymbol">*</span>
			                    </div>
			                </div>
							<!-- 专车新增 begin -->
							<c:if test="${currentBuOrgCd != null and currentBuOrgCd == '00000008'}">
							<div class="fieldBox col_33">
								<div class="label">经销商类别（专车）</div>
								<div class="field">
									<input type="text" id="splTypCd" name="splTypCd" value="请选择"
										   ltype="combobox" validate="{required:true}"/>
								</div>
								<%--<div class="field">--%>
									<%--<select name="splTypCd" id="splTypCd" data-value=" ">--%>
										<%--<option value=" " selected="selected">请选择</option>--%>
										<%--<c:forEach items="${searchSplTypCdList }" var="stc">--%>
											<%--<option value="${stc.key }">${stc.value }</option>--%>
										<%--</c:forEach>--%>
									<%--</select>--%>
								<%--</div>--%>
							</div>
							<div class="fieldBox col_33" >
								<div class="label">合作开始时间（专车）</div>
								<div class="field">
									<input type="text" id="coopDt" name="coopDt" class="ui-datepicker" value="" validate="{required:true}"/>
								</div>
							</div>
							<%--<div id="zk" style="display: none">--%>
							<div class="fieldBox col_33" id = "zk_01" style="display: none">
								<div class="label">代理商协议乙方</div>
								<div class="field">
									<input type="text" id="agtSec" name="agtSec"  value="" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_02" style="display: none">
								<div class="label">代理商协议丙方</div>
								<div class="field">
									<input type="text" id="agtThd" name="agtThd"  value="" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_03" style="display: none">
								<div class="label">代理商基础任务量</div>
								<div class="field">
									<input type="text" id="bscTaskQty" name="bscTaskQty"  value="" validate="{number:true}" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_04" style="display: none">
								<div class="label">代理商入网保证金</div>
								<div class="field">
									<input type="text" id="entDepAmt" name="entDepAmt"  value="" validate="{number:true}" />
								</div>
							</div>
							<div class="fieldBox col_33" id = "zk_05" style="display: none">
								<div class="label">我司提供车辆最高总价值</div>
								<div class="field">
									<input type="text" id="prdMaxValAmt" name="prdMaxValAmt"  validate="{number:true}" />
								</div>
							</div>
							<%--</div>--%>
							</c:if>
							<!-- 专车新增 end-->
							<div class="fieldBox col_33">
			                    <div class="label">经营类型(新车)</div>
			                    <div class="field">
			                    	<input type="text" id="newCarTyp" name="newCarTyp" ltype="combobox" validate="{required:false}"/>

			                    	<span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">经营类型(二手车)</div>
			                    <div class="field">
			                    	<input type="text" id="usedCarTyp" name="usedCarTyp" ltype="combobox" validate="{required:false}"/>
			                    	<span class="requiredSymbol">*</span>
			                    </div>
			                </div>
			                <div class="fieldBox col_33">
			                    <div class="label">经销品牌(卡车类)</div>
			                    <div class="field">
			                    	<input type="text" id="tkBrCd" name="tkBrCd" ltype="combobox" validate="{required:false}"/>
			                    </div>
			                </div>
			                <!-- <div class="fieldBox col_33">
			                    <div class="label">经销品牌(乘用车类)</div>
			                    <div class="field">
			                    	<input type="text" id="carBrCd" name="carBrCd" ltype="combobox" validate="{required:false}"/>
			                    </div>
			                </div> -->
			                <div class="fieldBox col_33">
			                    <div class="label">经销品牌(客车类)</div>
			                    <div class="field">
			                    	<input type="text" id="busBrCd" name="busBrCd" ltype="combobox" validate="{required:false}"/>
			                    </div>
			                </div>

			                <div class="fieldBox col_100">
			                    <div class="label">其他信息</div>
			                    <div class="field" style="width: 100%;">
			                        <textarea name="othInfoCd" id="othInfoCd" rows="4" class="l-textarea" style="width:99%" value="" ></textarea>
			                    </div>
			                </div>
			                <div class="fieldBox col_100_auto">
			                    <div class="label">经销商所属厂商</div>
			                    <div class="field">
			                        <input name="mfrIds" id="mfrIds" type="text" value="" placeholder="请选择" ltype="combobox">
			                    </div>
			                </div>
			                <div class="fieldBox col_100_auto">
			                    <div class="label">所属交易市场</div>
			                    <div class="field">
			                        <input name="atcIdNm" id="atcIdNm" type="text" value="" class="ui-textbox" placeholder="请选择" >
			                    </div>
			                </div>
			                <input type="hidden"  id="atcId" name="atcId"  class="ui-textbox" value="">
							<div class="fieldBox col_33">
								<div class="label">经销商返利比例%</div>
								<div class="field" style="width: 100%;">
									<input name="rebPct" id="rebPct" type="text" class="ui-textbox" value="" validate ="{number:true}" disabled="disabled">
								</div>
							</div>
							<!-- add by zhaoyong 20170829 begin -->
							<!-- <div class="fieldBox col_33">
			                    <div class="label">是否有权查询征信</div>
			                    <div class="field">
		                            <input id="isAuthCrdChkYes" type="radio" value="1" name="isAuthCrdChk" /> 是
		                            <input id="isAuthCrdChkNo" type="radio" value="0" name="isAuthCrdChk" /> 否
		                        </div>
			                </div> -->
							<!-- 2020-06-18 17:45:05 供应商准入初始化默认查征信次数 , 取消页面查征信次数填写 -->
							<%--<div class="fieldBox col_33">
								<div class="label">每日可查询征信次数</div>
								<div class="field" style="width: 100%;">
									<input name="limChkTms" id="limChkTms" type="text" class="ui-textbox" value="" validate ="{number:true,required:true}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>--%>
							<!-- add by zhaoyong 20170829 end -->
			                <div id="dyncdiv">
			                	<%-- <jsp:include page="prdSplInfoAddDynamicPage.jsp"></jsp:include> --%>
			                </div>
			                <c:if test="${isShowAuditBtn==1 }">
					            <div class="caption">
					            	<span class="title">资料信息</span>
					        	</div>
					        	<div class="fieldBox col_100">
									<div id="fileList">
										<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecListDetail.jsp" flush="true" >
											<jsp:param name="pkId" value="${id }"/>
											<jsp:param name="tabNm" value="SPL_BSC_INFO"/>
										</jsp:include>
									</div>
								</div>
							</c:if>
		                </div>
			            <div class="sqPanel">
			                <div class="sqPanel_head inL">
			                    <div class="btnsBox inLC">
			                    	<span id="spl_rl_add_btn" class="sq-button sq-button-round" onclick="splRlAddBtnEvent();">添加</span>
			                    </div>
			                    <span>主要人员信息</span>
		                    	<!-- <span id="readRlBtn" disabled="disabled" class="sq-button sq-button-round">一键读取高管信息</span> -->
<%--
								<input type="button"  class="sq-button sq-button-round" id = "readRlBtn" value="一键读取高管信息">
--%>
			                </div>
			                <div class="sqPanel_body">
			                    <div id="ligergrid_A1" class="sq-grid"></div>
			                </div>
			            </div>
		            </c:if>

		            <div class="btnsBox">
		                <span id="saveBtn1" class="sq-button sq-button-round">保存</span>
		                <span style="display:none" id="saveBtn2" onclick="modifyAudStsCd();" class="sq-button sq-button-round">提交</span>
						<c:if test="${isFLow != '1'}">
							<span id="saveBtn3" onclick="startSqlAdmissionFlow();" class="sq-button sq-button-round">发起审核流程</span>
						</c:if>
		                <input name="sId" id="sId" type="hidden" value="${id }">
		                <c:if test="${isShowAuditBtn==1 }">
			                <span id="passBtn" class="sq-button sq-button-round" onclick="auditPass(${id});">审核通过</span>
			                <span id="noPassBtn" class="sq-button sq-button-round" onclick="auditNoPass(${id});">审核不通过</span>
		                </c:if>
						<input name="qualTypCd" id="qualTypCd" type="hidden" value="${qualTypCd }">
						<input name="splAttrCd" id="splAttrCd" type="hidden" value="${splAttrCd }">
		            </div>
	            </form>
		</div>
		<div tabid="tabB" title="备案资料">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
		<!-- <div tabid="tabC" title="备案授信">
            <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
        </div> -->
		<div tabid="tabD" title="备案账号">
            <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
        </div>
		<div tabid="tabE" title="相关项目">
            <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
        </div>
		<%--//修改供应商流程权限变更  fengzuoxiang  2019-06-14--%>
        <%--<c:if test="${currBuOrgCd=='00000001' }">--%>
	        <%--<div tabid="tabF" title="流程权限列表">--%>
	            <%--<iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>--%>
	        <%--</div>--%>
        <%--</c:if>--%>
        <div tabid="tabG" title="配置维护">
            <iframe frameborder="0" name="tabG" id="tabG" src=""></iframe>
        </div>
        <div tabid="tabH" title="承诺协议">
            <iframe frameborder="0" name="tabH" id="tabH" src=""></iframe>
        </div>
		<div tabid="tabJ" title="人工干预">
			<iframe frameborder="0" name="tabJ" id="tabJ" src=""></iframe>
		</div>
	<c:if test="${currentBuOrgCd == '00000001' || (isFlow == 1 && isModify == '0' && currentBuOrgCd == '00000001') || (isFlow == 1 && isModify == '1') }">
		<div tabid="tabL" title="特殊业务权限列表">
			<iframe frameborder="0" name="tabJ" id="tabL" src=""></iframe>
		</div>
	</c:if>

</div>

	<!-- 操作原因 -->
	<form id="reasonFromSet" style="display:none;">
		<div class="field">
			<textarea name="reason" id="reason" class="ui-textarea l-textarea" style="width:360px;height: 150px;" validate="{required:true}" ></textarea>
		</div>
	</form>

	<!-- 添加自然人社会关系表单 -->
	<form id="npSocialRlFormSet" style="display:none;">
		<div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
                <div class="fieldBox col_50">
                    <div class="label">关系</div>
                    <div class="field">
                        <select name="npRlTypCd" id="npRlTypCd" data-value="" validate="{required:true, select: true}">
			            	<c:forEach items="${rlTypCDListJSON }" var="kv" begin="0" step="1" varStatus="status">
								<c:if test="${status.index == 0}">
								     <option value="${kv.key }" checked >${kv.value }</option>
								</c:if>
							<c:if test="${status.index != 0}">
								    <option value="${kv.key }">${kv.value }</option>
								</c:if>
							</c:forEach>
			            </select>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">姓名</div>
                    <div class="field">
                        <input name="npRlNm" id="npRlNm" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                        <input name="cstId" id="cstId" type="text" hidden="true" value=""/>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">性别</div>
                    <div class="field">
                        <div id="sexRadioList"></div>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">手机号</div>
                    <div class="field">
                        <input name="npMp" id="npMp" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">工作单位</div>
                    <div class="field">
                        <input name="npWorkPlc" id="npWorkPlc" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label">职务</div>
                    <div class="field">
                        <input name="npPos" id="npPos" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">单位电话</div>
                    <div class="field">
                        <input name="npTel" id="npTel" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">证件类型</div>
                    <div class="field">
                        <select name="npCertTypCd" id="npCertTypCd" data-value="" validate="{required:true, select: true}">
			            	<c:forEach items="${certTypCdListJSON }" var="kv" begin="0" step="1" varStatus="status">
								<c:if test="${status.index == 0}">
								     <option value="${kv.key }" checked >${kv.value }</option>
								</c:if>
							<c:if test="${status.index != 0}">
								    <option value="${kv.key }">${kv.value }</option>
								</c:if>
							</c:forEach>
			            </select>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">证件号</div>
                    <div class="field">
                        <input name="npCertNo" id="npCertNo" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">通讯地址邮编</div>
                    <div class="field">
                        <input name="npZipNo" id="npZipNo" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_66">
                    <div class="label">身份证地址</div>
                    <div class="field">
                        <input name="npIdAddr" id="npIdAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_66">
                    <div class="label">现居住地</div>
                    <div class="field">
                        <input name="npHomeAddr" id="npHomeAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_66">
                    <div class="label">单位地址</div>
                    <div class="field">
                        <input name="npWorkAddr" id="npWorkAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_66">
                    <div class="label">通讯地址</div>
                    <div class="field">
                        <input name="npPostAddr" id="npPostAddr" type="text" class="ui-textbox" value="" validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_100_auto">
                    <div class="label">备注</div>
                    <div class="field">
                        <textarea name="npRlRem" id="npRlRem" rows="4"
										class="l-textarea" style="width: 99%" value=""></textarea>
                    </div>
                </div>
            </div>
	</form>

<script type="text/javascript">
var bool= false;
var extData = null;
var npSocialRlGrid;//法人供应商联系人GRID
var splNpSocialRlGrid;//自然人供应商联系人GRID
var _brJson = [];
var loadedTabs=[];
var lxxz = '${lxxz}';
var prdmarks = '${prdmarks}';
var importDataSource = '${importDataSource}';

var proIntId = '${proIntId}';
var splAttrCd = '${splAttrCd}';
var qualTypCd = '${qualTypCd}' ;
if(StringUtils.isEmpty(qualTypCd)){
    if(splAttrCd == '1'){
        qualTypCd = null ;//自然人，无经销商资质类型
	}else{
        qualTypCd = '2'; //三证合一
	}
}
var onlyMdfFlag = '';
if(StringUtils.isEmpty(proIntId)){
	onlyMdfFlag = '${onlyMdfFlag}';
}else{
	onlyMdfFlag = '0';
}
var oldAgtSec ="";
var oldAgtThd ="";
var oldBscTaskQty ="";
var oldEntDepAmt ="";
var oldPrdMaxValAmt ="";
var npSocialRlList = [];
var _isModify = '${isModify}';
var _isApply = '${isApply}';
var _mdfFile = '${mdfFile}';
var _isShowBigCustomer = '${isShowBigCustomer}';
var clickNum = 0;

$(function(){
	var _tkBrCdListJSON = ${tkBrCdListJSON};
    $("#tkBrCd").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _tkBrCdListJSON,
        valueField: 'key',
        textField:'value'
    });
	var _carBrCdListJSON = ${carBrCdListJSON};
    $("#carBrCd").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _carBrCdListJSON,
        valueField: 'key',
        textField:'value'
    });
	var _busBrCdListJSON = ${busBrCdListJSON};
    $("#busBrCd").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _busBrCdListJSON,
        valueField: 'key',
        textField:'value'
    });
    var _newCarTypJSON = ${newCarTypJSON};
    $("#newCarTyp").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _newCarTypJSON,
        valueField: 'key',
        textField:'value'
    });
    var _usedCarTypJSON = ${usedCarTypJSON};
    $("#usedCarTyp").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _usedCarTypJSON,
        valueField: 'key',
        textField:'value'
    });

    var _bizScopeTypJSON = ${bizScopeTypJSON};
    $("#bizScope").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _bizScopeTypJSON,
        valueField: 'key',
        textField:'value'
    });
   /*  var _splLvlTypJSON = ${splLvlTypJSON}
    $("#splLvlTyp").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _splLvlTypJSON,
        valueField: 'key',
        textField:'value'
    });
    var _prjLvlTypJSON = ${prjLvlTypJSON}
    $("#prjLvlTyp").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _prjLvlTypJSON,
        valueField: 'key',
        textField:'value'
    }); */
    //项目类型
    var _prjTypCdsJson = ${prjTypCdsJson};
    $("#prjTypCds").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _prjTypCdsJson,
        valueField: 'key',
        textField:'value',
    });
	// 专车事业部 经销商类别
	var _searchSplTypCdList = ${searchSplTypCdList};
	$("#splTypCd").ligerComboBox({
		isShowCheckBox: true,
		isMultiSelect:false,
		data: _searchSplTypCdList,
		valueField: 'key',
		textField:'value',
		onChangeValue :function(value) {
			var _splTypCd = liger.get("splTypCd");
			var splTypCd = _splTypCd.getValue();
			if(splTypCd != null && splTypCd.toString().indexOf('1') > -1){
				$("#zk_01").css("display", 'block');
				$("#zk_02").css("display", 'block');
				$("#zk_03").css("display", 'block');
				$("#zk_04").css("display", 'block');
				$("#zk_05").css("display", 'block');
				$("#agtSec").val(oldAgtSec);
				$("#agtThd").val(oldAgtThd);
				$("#bscTaskQty").val(oldBscTaskQty);
				$("#entDepAmt").val(oldEntDepAmt);
				$("#prdMaxValAmt").val(oldPrdMaxValAmt);
			}else{
				$("#zk_01").css("display", 'none');
				$("#zk_02").css("display", 'none');
				$("#zk_03").css("display", 'none');
				$("#zk_04").css("display", 'none');
				$("#zk_05").css("display", 'none');
				$("#agtSec").val("");
				$("#agtThd").val("");
				$("#bscTaskQty").val("");
				$("#entDepAmt").val("");
				$("#prdMaxValAmt").val("");
			}
		}
	});
    //事业部
	var _buOrgCdsJson = ${buOrgCdsJson};
	$("#buOrgCds").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
        data: _buOrgCdsJson,
        valueField: 'key',
        textField:'value',
        onChangeValue :function(value){
        	var _buOrg = liger.get("buOrgCds");
        	var _buOrgCds = _buOrg.getValue();
        }
    });

	var formSet1 = $('#formSet1').ligerForm({
        validate : true
	});
	formSet1.setFieldValidate("rgnProvCd", {
        required: true,
        select: false
    });
	formSet1.setFieldValidate("rgnCityCd", {
        required: true,
        select: false
    });
	$('#reasonFromSet').ligerForm({
        validate : true
	});
	var _mfrId = '${mfrId}';
	if(_mfrId!=""){
		comboGrid_defaultValue = _mfrId;
	}
	var _buOrgCd = '${buOrgCd}';
	var id = $("#sId").val();
	if(!id){
		if(_buOrgCd!=""){
			$("#buOrgCds").ligerGetComboBoxManager().selectValue(_buOrgCd);
			$("#buOrgCds").ligerGetComboBoxManager().updateStyle();
		}
	}

	$("#readBtn").click(function (){
		var _id = $("#sId").val();
		var _splNm = $("#splNm").val();
		//var _id = 1;
		$("#readBtn").attr("disabled","disabled");
    	$('#readBtn').css("background-image","-webkit-linear-gradient(top, #999, #999)");
		var url = '<%=path%>/spl/splCommBasic/getByDataId.do';
		var wait_dialog;
		$.ajax({
			type: 'get',
			dataType:'json',
			data:{dataId:_id,type:2,dataNm:_splNm},
			url: url,
			beforeSend: function(){
		          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
			success:function(msg){
				 wait_dialog.close();
				 if(msg.success == 1){
					 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
					 $("#succ").val(msg.data.creditcode);
					 $("#regDt").val(msg.data.rundatefrom);
					 $("#regCapAmt").val(msg.data.regcapamt);
					 $("#paidCapAmt").val(msg.data.fctcapamt);
					 $("#regAddr").val(msg.data.address);
				 }else{
					 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	});

	$("#saveBtn1").click(function(event) {
		//$.ligerDialog.SQopen({
		//	width: 400,
        //    height:230,
        //    title : '操作原因',
        //    target : $('#reasonFromSet'),
        //    //url:'<%=path%>/spl/splOpLogRec/toAddBlackListReasonPage.do?splId='+_id,
        //    buttons: [{
        //        	text: "确定", type: 'ok', cls: 'l-dialog-btn-ok',
	    //            onclick: function (item, Dialog) {
	    //            		var form = new liger.get("reasonFromSet");
	    //            		if (!form.valid()) {
	    //            	    	top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
	    //            	        return false; //验证不通过，不执行以下代码
	    //            	    }
		wsCheck();
		 /*if(wsCheck()){
			addSpl();
		 }*/
	   //             		//Dialog.close();
	   //             		Dialog.hide();
	   //             }
	   //         }, {
	   //             text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
	   //             onclick: function (item, Dialog) {
	   //             	//Dialog.close();
       //         		Dialog.hide();
	   //             }
	   //         }
      //  	]
      //  });
	});
	function wsCheck() {
        console.log(clickNum);
        if(clickNum > 0){
            $.ligerDialog.SQalert({content: "点击太快，处理中。请稍后或刷新页面...", SQ_type: "waitting"});
            return;
        }
        clickNum = 1;
		var _form = liger.get("formSet1");
		var _data = _form.getData();
		if($('#splAttrCd').val() != CustomerConstant.CST_TYPE_NP_CD){
			_data["npSocialRlGridJSON"] = JSON.stringify(npSocialRlGrid.getData());
		}
		if ($('#splAttrCd').val() == CustomerConstant.CST_TYPE_NP_CD) {
			_data["npSocialRlGridJSON"] = JSON.stringify(npSocialRlList);
		}
		var _url = '<%=path%>/npspl/splnpbscinfo/kingDeeWsCheck.do';

		$.ajax({
			type: 'post',
			url: _url,
			data: _data,
			dataType: "json",
			success: function (msg) {
				if ( 0 == msg.success) {
					$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
					return false;
				}else if(1 == msg.success){
					addSpl();
				}
			}
		});
        clickNum = 0;
	}
	function addSpl(){
		var form = liger.get("formSet1");
		var reason = $('#reason').val();
	    if (!form.valid()) {
	    	$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
            return false; //验证不通过，不执行以下代码
        }
	    if($("#splAttrCd").val()!=1){
		    if(StringUtils.isEmpty($("#newCarTyp").val()) && StringUtils.isEmpty($("#usedCarTyp").val())){
		    	$.ligerDialog.SQalert({content: "请选择经营类型" , SQ_type: "warning" });
		    	return false; //验证不通过，不执行以下代码
		    }
		}
		//区分自然人判断
		if($("#splAttrCd").val()!=1){
			var isValid = SQ.validGrid('ligergrid_A1');
	        if (isValid == false) {
	            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
	            return false;
	        }
		}

	    var data = form.getData();
	    data.isBuyBack = $('input[name="isBuyBack"]:checked ').val();
	    /* zhaoyong  */
	    data.isAuthCrdChk = $('input[name="isAuthCrdChk"]:checked ').val();
	    //tkBrCd
	    data["regDt"] = $("#regDt").val();
        data["expDt"] = $("#expDt").val();
        data["rgnPrCd"] = getRgnProvCd();//获取省代码
	    data["rgnCyCd"] = getRgnCityCd();//获取市代码

	    data["reason"] = reason;

		data["splAttrCd"] = $("#splAttrCd").val();
	  	//增加判断经销商属性，决定有无主要联系人  zhaoyong
	  	if($('#splAttrCd').val() != CustomerConstant.CST_TYPE_NP_CD){
	  		data["npSocialRlGridJSON"] = JSON.stringify(npSocialRlGrid.getData());
	  	}
	  	if ($('#splAttrCd').val() == CustomerConstant.CST_TYPE_NP_CD) {
	  		//for (i in npSocialRlList) {
	  			//npSocialRlList[i].__id = null;
	  		//}
	  		data["npSocialRlGridJSON"] = JSON.stringify(npSocialRlList);
	  	}

	    var id = $("#sId").val();
	    var url;
	    var rlPsnGrid;
	    if ($('#splAttrCd').val() == CustomerConstant.CST_TYPE_NP_CD) {// 自然人
	    	url = '<%=path%>/npspl/splnpbscinfo/add.do';
	        if(id != ""){
	        	url = '<%=path%>/npspl/splnpbscinfo/modify.do';
	        	data["id"]= id;
	        }
	        rlPsnGrid = splNpSocialRlGrid;
	    } else {// 法人
	        url = '<%=path%>/product/splInfo/add.do';
	        if(id != ""){
	        	url = '<%=path%>/product/splInfo/modify.do';
	        	data["id"]= id;
	        }else{
	        	data["importDataSource"] = importDataSource;
	        }
	        rlPsnGrid = npSocialRlGrid;
	    }
		oldAgtSec="";
		oldAgtThd="";
		oldBscTaskQty="";
		oldEntDepAmt="";
		oldPrdMaxValAmt="";
		data["atcId"] = $("#atcId").val();
		//alert(JSON.stringify(data));
       var wait_dialog;
	    $.ajax({
			type: 'post',
			dataType:'json',
			data:data,
			url: url,
			async:false,
			beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
			success:function(msg){
				 wait_dialog.close();
				 if(msg.success == 1){
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
					 if(msg.data){
						 $("#sId").val(msg.data);
						 rlPsnGrid.setParm("splId",msg.data);
						 npSocialRlList = [];
						 rlPsnGrid.reload();
					     initBtn($("#buOrgCds").val());
					 }else{
						 rlPsnGrid.setParm("splId",$("#sId").val());
						 npSocialRlList = [];
						 rlPsnGrid.reload();
						 initBtn($("#buOrgCds").val());
					 }
					//回调刷新列表
			        var callback = GET_W2Wcallback();
			        callback();
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	}

	$("#atcIdNm").click(function(event) {
	    $.ligerDialog.open({  title: '选择交易市场',height: 500,width: 850, url: '<%=path%>/product/splInfo/toChooseAtcPage.do?'});
	});
	var _isFlow = '${isFlow}';
	console.info(_isFlow)
	if(1 == _isFlow) {
		$("#saveBtn3").hide();
	}

	initTab();
	initData();
	initStyle();
	if (${splAttrCd == 1} ) {
		initNpSplRlGrid();
	} else {
		initSplRlGrid();
	}
	if(${id == null || id == ''}) {
		readManagerInfo();
	}
	disableFiled();
});

var currBuOrgCd = '${currBuOrgCd}';
function disableFiled(){
	var succ = $("#succ").val();
	console.info(succ)
	if(succ) {
		if (liger.get("succ")) {
			liger.get("succ").setDisabled(true);
		}
	}
	if(onlyMdfFlag==1){
		if(liger.get("splNm")){
			liger.get("splNm").setDisabled(true);
		}
		if(liger.get("bizLicNo")){
			liger.get("bizLicNo").setDisabled(true);
		}
		if(liger.get("succ")){
			liger.get("succ").setDisabled(true);
		}
		if(liger.get("taxRegNo")){
			liger.get("taxRegNo").setDisabled(true);
		}
		if(liger.get("orgCode")){
			liger.get("orgCode").setDisabled(true);
		}
		//非汽车金融  经销商类型禁止
		if(currBuOrgCd!='00000005'){
			if(liger.get("prjLvlCd")){
				liger.get("prjLvlCd").setDisabled(true);
			}
		}
		//非重卡  经销商级别禁止
		if(currBuOrgCd!='00000001'){
			if(liger.get("splLvlCd")){
				liger.get("splLvlCd").setDisabled(true);
			}
		}
		if(liger.get("splTel")){
			liger.get("splTel").setDisabled(true);
		}
		if(liger.get("splFax")){
			liger.get("splFax").setDisabled(true);
		}
		if(liger.get("corpTypCd")){
			liger.get("corpTypCd").setDisabled(true);
		}
		if(liger.get("regDt")){
			liger.get("regDt").setDisabled(true);
		}
		if(liger.get("expDt")){
			liger.get("expDt").setDisabled(true);
		}
		if(liger.get("regCapAmt")){
			liger.get("regCapAmt").setDisabled(true);
		}
		if(liger.get("regCapUntCd")){
			liger.get("regCapUntCd").setDisabled(true);
		}
		if(liger.get("paidCapAmt")){
			liger.get("paidCapAmt").setDisabled(true);
		}
		if(liger.get("paidCapUntCd")){
			liger.get("paidCapUntCd").setDisabled(true);
		}
		if(liger.get("ownerCd")){
			liger.get("ownerCd").setDisabled(true);
		}

		if($("#radio")){
			$("#yesRadio").attr("disabled", true);
			$("#noRadio").attr("disabled", true);
		}
		if(liger.get("regAddr")){
			liger.get("regAddr").setDisabled(true);
		}
		//禁用省市
		disabledRgnProvCd();
		disabledRgnCityCd();
		if(liger.get("websit")){
			liger.get("websit").setDisabled(true);
		}
		if(liger.get("bizScope")){
			liger.get("bizScope").setDisabled(true);
		}
		if(liger.get("fileNo")){
			liger.get("fileNo").setDisabled(true);
		}
		if(liger.get("postAddr")){
			liger.get("postAddr").setDisabled(true);
		}
		if(liger.get("zipNo")){
			liger.get("zipNo").setDisabled(true);
		}
		if(liger.get("prjTypCds")){
			liger.get("prjTypCds").setReadonly(true);
		}
		if(liger.get("tkBrCd")){
			liger.get("tkBrCd").setReadonly(true);
		}
		if(liger.get("carBrCd")){
			liger.get("carBrCd").setReadonly(true);
		}
		if(liger.get("busBrCd")){
			liger.get("busBrCd").setReadonly(true);
		}
		// if(liger.get("bizScope")){
		// 	liger.get("bizScope").setDisabled(true);
		// }
		$("#othInfoCd").setDisabled_ligerTextarea(true);
		if(liger.get("mfrIds")){
			liger.get("mfrIds").setReadonly(true);
		}
		if(liger.get("rebPct")){
			liger.get("rebPct").setDisabled(true);
		}

	}
}

//审核通过
function auditPass(_splId){
	if(StringUtils.isEmpty(_splId)) return;
	var url = '<%=path%>/product/splInfo/modifyAudStsCd.do';
    var wait_dialog;
    $.ajax({
		type: 'post',
		dataType:'json',
		data:{id:_splId,audStsCd:FlowConstant.FLOW_CHECK_STATE_PASS},
		url: url,
		beforeSend: function(){
	          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
	     },
		success:function(msg){
			 wait_dialog.close();
			 if(msg.success == 1){
				 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
				//回调刷新列表
		        var callback = GET_W2Wcallback();
		        callback();
			 }else{
				 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
			 }
		}
	});
}
//审核不通过
function auditNoPass(_splId){
	if(StringUtils.isEmpty(_splId)) return;
	var url = '<%=path%>/product/splInfo/modifyAudStsCd.do';
    var wait_dialog;
    $.ajax({
		type: 'post',
		dataType:'json',
		data:{id:_splId,audStsCd:FlowConstant.FLOW_CHECK_STATE_NO_PASS},
		url: url,
		beforeSend: function(){
	          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
	     },
		success:function(msg){
			 wait_dialog.close();
			 if(msg.success == 1){
				 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
				//回调刷新列表
		        var callback = GET_W2Wcallback();
		        callback();
			 }else{
				 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
			 }
		}
	});
}

function buOrgCdChange(){

}

function initBtn(marks){
	var marksArr = marks.split(";");
	if(lxxz=="true"){
		for(var i=0;i<marksArr.length;i++){
			if(marksArr[i]=="汽车金融事业部"){
				$("#saveBtn3").show();
				$("#saveBtn2").hide();
				return;
			}else{
				$("#saveBtn3").hide();
				$("#saveBtn2").show();
			}
		}
	}
}

function modifyAudStsCd(){
	var _id = $("#sId").val();
	var _audStsCd = FlowConstant.FLOW_CHECK_STATE_IN;
    if(!_id || !_audStsCd)return;
    var url = '<%=path%>/product/splInfo/modifyAudStsCd.do';
    var wait_dialog;
    $.ajax({
		type: 'post',
		dataType:'json',
		data:{
			id:_id,
			audStsCd:_audStsCd
		},
		url: url,
		beforeSend: function(){
	          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
	     },
		success:function(msg){
			 wait_dialog.close();
			 if(msg.success == 1){
				 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
				 $("#saveBtn2").hide();
				 $("#saveBtn3").hide();
				 Remove_navTab();
				 //grid.reload();
			 }else{
				 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
			 }
		}
	});
}

//发起审核流程
function startSqlAdmissionFlow(){
	var _id = $("#sId").val();
	if(!_id) {
        top.$.ligerDialog.SQalert({content: "请先保存基础信息！", SQ_type: "error"});
	    return;
    }
	//var modelTyp = FlowConstant.FLOW_MODEL_TYP_SPL_ACCESS;//流程业务分类-经销商准入
	var modelTyp = "033";
	if(StringUtils.isEmpty(modelTyp)){
		console.log("modelTyp is null");
		return;
	}

	//$.ligerDialog.SQopen({
	//	width: 400,
    //    height:230,
    //    title : '操作原因',
    //    target : $('#reasonFromSet'),
    //    //url:'<%=path%>/spl/splOpLogRec/toAddBlackListReasonPage.do?splId='+_id,
     //   buttons: [{
     //       	text: "确定", type: 'ok', cls: 'l-dialog-btn-ok',
     //           onclick: function (item, Dialog) {
     //           		var form = new liger.get("reasonFromSet");
     //           		if (!form.valid()) {
     //           	    	top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
     //           	        return false; //验证不通过，不执行以下代码
      //          	    }
                		continueStartSqlAdmissionFlow(_id,modelTyp);
      //          		Dialog.hide();
      //          		$('#reason').val('');
     //           }
      //      }, {
      ///          text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
      //          onclick: function (item, Dialog) {
      //          	Dialog.hide();
      //          	$('#reason').val('');
      //          }
      //      }
    	//]
    //});
}

function continueStartSqlAdmissionFlow(_id,modelTyp){
	var reason = $('#reason').val();
	var flowDialog = $.ligerDialog.SQopen({
		url: '<%=path%>/flow/flow/toForStartListPage.do?modelTyp='+modelTyp,
		width: 700,
		height:400,
		title : '请选择要发起的流程',
		buttons: [{
			text: "确定", type: 'ok', cls: 'l-dialog-btn-ok',
			onclick: function (item, Dialog) {
				if (Dialog.onOk) Dialog.onOk();
			}
		}, {
			text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
			onclick: function (item, Dialog) {
				if (Dialog.onCancel) Dialog.onCancel();
			}
		}
		],
		onClose: function () {
			var json = flowDialog._DATA;
			console.log(json);
			if(!json){
				return;
			}
			var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting",onClose: function () {}});
			$.ajax({
				type: 'post',
				dataType:'json',
				data:{
					id:_id,
					procDefKey:json.procDefKey,
					procDefId:json.procDefId,
					procNo:json.procNo,
					reason:reason
				},
				url: '<%=path%>/product/splInfo/addFlowStart.do',
				success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						$.ligerDialog.SQalert({content:msg.info, SQ_showButtons: true,SQ_type: "success",SQ_onBtnclick:function(){grid.reload();}});
						$("#saveBtn2").hide();
						$("#saveBtn3").hide();
						Remove_navTab();
					}else{
						UIUtils.alertErrorHold1(msg.info);
					}
				}
			});
		}
	});
}

		function initStyle(){
			/* $("#succ").attr("readonly", "readonly");
            $("#regDt").attr("readonly", "readonly");
            $("#regCapAmt").attr("readonly", "readonly");
            $("#paidCapAmt").attr("readonly", "readonly");
            $("#bizScope").disabled=true;
            $("#regAddr").attr("readonly", "readonly"); */
		}
		function initData(){
			var id = $("#sId").val();
			var sign = '${sign}';
			var _splNm = $("#splNm").val();
			var _splAttrCd = $('#splAttrCd').val();
			$("#rebPct").val(100);
			if(sign == 1){
				return ;
			}
	    	var _url = '<%=path%>/product/splInfo/getById.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{id:id,splNm:_splNm,splAttrCd:_splAttrCd},
	    		url: _url,
	    		success:function(msg){
	    			 if(msg.success == 1){
	    				 if (msg.data != null) {
		    				 extData = msg.data;
		    				 setData(msg.data);//设置数据
	    				 }
	    			 }else{
	    				 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
	    			 }
	    		}
	    	});
    	}

		//设置页面数据
	    function setData(data){
	    	var form = liger.get("formSet1");
	    	form.setData({
	    		corpTypCd:data.corpTypCd,
                ownerCd: data.ownerCd,
	    		splLvlCd:data.splLvlCd,
	    		paidCapUntCd:data.paidCapUntCd,
	    		regCapUntCd:data.regCapUntCd
	    	});

	    	//add by zhaoyong 20170829   begin
	    	//是否可以查询征信
/* 	    	$("input[name='isAuthCrdChk'][value="+data.isAuthCrdChk+"]").prev(".l-radio").click();
 */	    	//$("#limChkTms").val(data.limChkTms);
	    	//add by zhaoyong 20170829   end
	    	//区域数据处理
	    	setRgnProvCdUpdataValue(data.rgnPrCd);
	    	setRgnCityCdUpdataValue(data.rgnCyCd);
	    	setRegionSelectDataChange();


	    	$("#splNm").val(data.splNm);
	    	$("#succ").val(data.succ);
			if(data.succ){
				if (liger.get("succ")) {
					liger.get("succ").setDisabled(true);
				}
			}
	    	$("#taxRegNo").val(data.taxRegNo);
	    	$("#splTel").val(data.splTel);
	    	$("#splFax").val(data.splFax);
	    	$("#bizLicNo").val(data.bizLicNo);
	    	//alert(JSON.stringify(data));
	    	$("#atcId").val(data.atcId);
	    	$("#atcIdNm").val(data.atcIdNm);
	    	//修改时 如果营业执照号为空(老数据导过来就没有) 放开营业执照的禁用
	    	//if(StringUtils.isEmpty(data.bizLicNo)){
	    	//}

	    	if(onlyMdfFlag==0 && '${isSplNmModify}' != 0){
		    	//开放经销商名称 营业执照 修改权限
	    		liger.get("splNm").setEnabled();
	    		//liger.get("bizLicNo").setEnabled();
	    	}

	    	$("#orgCode").val(data.orgCode);
	    	$("#regCapAmt").val(data.regCapAmt);
	    	$("#regCapUntCd").val(data.regCapUntCd);
	    	$("#paidCapAmt").val(data.paidCapAmt);
	    	$("#paidCapUntCd").val(data.paidCapUntCd);
	    	$("#ownerCd").val(data.ownerCd);
	    	$("#regAddr").val(data.regAddr);
	    	$("#postAddr").val(data.postAddr);
	    	$("#websit").val(data.websit);
	    	$("#bizScope").val(data.bizScopeCdNms);
	    	$("#othInfoCd").val(data.othInfoCd);
	    	//$("#fileNo").val(data.fileNo);
	    	$("#zipNo").val(data.zipNo);
			if(data == null ||data.rebPct ==0 || data.rebPct == '' ||data.rebPct == '0' ||data.rebPct == null){
				$("#rebPct").val(100);
			}else{
				$("#rebPct").val(data.rebPct);
			}
	    	//日期处理
	    	if(data.regDt){
	    		var date = new Date(data.regDt);
	    		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
	    		$("#regDt").val(dateStr);
	    	}
	    	if(data.expDt){
	    		var date = new Date(data.expDt);
	    		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
	    		$("#expDt").val(dateStr);
	    	}
	    	//所属事业部 处理
	    	var buOrgCdsString  = data.buOrgCdsString;
	    	$("#buOrgCds").ligerGetComboBoxManager().selectValue(buOrgCdsString);
	    	$("#buOrgCds").ligerGetComboBoxManager().updateStyle();
	    	//品牌处理
	    	var tkBrCdsString  = data.tkBrCdsString;
	    	$("#tkBrCd").ligerGetComboBoxManager().selectValue(tkBrCdsString);
	    	$("#tkBrCd").ligerGetComboBoxManager().updateStyle();
	    	if ($('#splAttrCd').val() == 1) {
		    	var carBrCdsString  = data.carBrCdsString;
		    	$("#carBrCd").ligerGetComboBoxManager().selectValue(carBrCdsString);
		    	$("#carBrCd").ligerGetComboBoxManager().updateStyle();
	    	}
	    	var busBrCdsString  = data.busBrCdsString;
	    	$("#busBrCd").ligerGetComboBoxManager().selectValue(busBrCdsString);
	    	$("#busBrCd").ligerGetComboBoxManager().updateStyle();

	    	if ($('#splAttrCd').val() != 1) {
		    	var newCarTypString  = data.newCarString;
		    	$("#newCarTyp").ligerGetComboBoxManager().selectValue(newCarTypString);
		    	$("#newCarTyp").ligerGetComboBoxManager().updateStyle();

		    	var usedCarTypString  = data.usedCarString;
		    	$("#usedCarTyp").ligerGetComboBoxManager().selectValue(usedCarTypString);
		    	$("#usedCarTyp").ligerGetComboBoxManager().updateStyle();

		    	var bizScope = data.bizScopeCdStr;
		    	$("#bizScope").ligerGetComboBoxManager().selectValue(bizScope);
		    	$("#bizScope").ligerGetComboBoxManager().updateStyle();
	    	}



			//是否回购处理
	    	$("input[name='isBuyBack'][value="+data.isBuyBack+"]").prev(".l-radio").click();
	    	//项目类型 处理
	    	var prjTypCdsString  = data.prjTypCdsString;
	    	$("#prjTypCds").ligerGetComboBoxManager().selectValue(prjTypCdsString);
	    	$("#prjTypCds").ligerGetComboBoxManager().updateStyle();
			// jiangzg add 2017-7-31 16:52:27 专车
			if(data.splTypCd){
				var cd = data.splTypCd;
				var _stc = $("#splTypCd").ligerGetCheckBoxManager();
				_stc.setValue(data.splTypCd);
				_stc.updateStyle();
			}
			if(data.coopDt){
				var date = new Date(data.coopDt);
				var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
				$("#coopDt").val(dateStr);
			}
			if(data.splTypCd !=null && '1' == data.splTypCd){
				$("#zk_01").css("display", 'block');
				$("#zk_02").css("display", 'block');
				$("#zk_03").css("display", 'block');
				$("#zk_04").css("display", 'block');
				$("#zk_05").css("display", 'block');
				$("#agtSec").val(data.agtSec);
				$("#agtThd").val(data.agtThd);
				$("#bscTaskQty").val(data.bscTaskQty);
				$("#entDepAmt").val(data.entDepAmt);
				$("#prdMaxValAmt").val(data.prdMaxValAmt);
				oldAgtSec = data.agtSec;
				oldAgtThd = data.agtThd;
				oldBscTaskQty = data.bscTaskQty;
				oldEntDepAmt = data.entDepAmt;
				oldPrdMaxValAmt = data.prdMaxValAmt;
			}
		};
		//动态字段值的设置
//		2017-5-20 12:38:28 by jiangzg delete
		function setExtData(data){
			var form = liger.get("formSet1");
			if(data){
				form.setData({
//		    		bilWayCd:data.bilWayCd,
		    		prjLvlCd:data.prjLvlCd,
		    	});
			}
		};
		var comboGrid_defaultValue="${mfrIdsString}"; //初始值(value)
        var comboGrid_defaultText="${mfrNms}"; //初始值(text)
        var isInit_setSearchComboVal = false; //是否初始化的时候已经赋完初始值？
		//厂商带搜索
		//var comboGrid_defaultValue = "${mfrIdsString}"; //厂商初始值
		var combo_Mng = $("#mfrIds").ligerComboBox({
            width: 400,
            selectBoxWidth: 380,
            selectBoxHeight: 240,
            valueField: 'id',
            textField: 'mfrName',
            isMultiSelect: true,
            grid: getGridOptions(true),
            condition: {
                labelWidth: 0,
                space: 5,
                fields: [{ name: 'mfrName', width: 150, keyName: 'id'}]
            },
            delayLoadGrid: false,
            onChangeValue: function (value) {
                if (combo_Mng) {
                	if (value=="") comboGrid_defaultValue = ""; //如果点击清空'x'，就滞空初始值
                    $("#mfrIds").show_ligerComboItems();
                };
                SetIframe_height();
            }
        });
        //$("#mfrIds").ligerGetComboBoxManager().updateStyle();//初始值之后需要刷新组件才有变化

        function getGridOptions(checkbox)
        {
    		var url;
        	var _splId = $("#sId").val();
    		if(!_splId){
    			url = '<%=path%>/product/mfrInfo/initList.do?flag=quote'
    		}else{
    			url = '<%=path%>/product/mfrInfo/initList.do?flag=quote&mfrIdsString='+comboGrid_defaultValue
    		}
            var options = {
            	usePager: false,
                columns: [
                    { display: '厂商', name: 'mfrName', minWidth: 300 }
                ],
                switchPageSizeApplyComboBox: false,
                url : url,
                method: 'get',
                dataAction: 'local',
                pageSize: 10,
                root:'rows',
                record:'total',
                usePagerOnLessPagesize: false,
                cssClass: "SMALL_grid",
                checkbox: checkbox,
                frozen: false,
                isSelected: function (rowdata) {
                    if (comboGrid_defaultValue == "") return false;
                    var defaultItems = comboGrid_defaultValue.split(";");
                    if(!isInit_setSearchComboVal) { //只在初始化时执行一次，在onAfterShowData后改变
	                    for (var i = 0; i < defaultItems.length; i++) {
	                    	if(rowdata[combo_Mng.options.valueField] == defaultItems[i]) return true;
	                    }
                    }
                    return false;
                },
                onAfterShowData: function (currentData) {
                	if(!isInit_setSearchComboVal) { //只在初始化时执行一次，在onAfterShowData后改变
	                	//combo_Mng.selectValue(comboGrid_defaultValue);
	                	combo_Mng.setInputValue(comboGrid_defaultValue, comboGrid_defaultText, true);
	                    isInit_setSearchComboVal = true;
                	}
                }
            };
            return options;
        }
        function readManagerInfo(){
        	//$("#readRlBtn").attr("disabled", "disabled");
        	//$('#readRlBtn').css("background-image","-webkit-linear-gradient(top, #999, #999)");
    		var _id = $("#sId").val();
    		var _splNm = $("#splNm").val();
    		//var _id = 17315;
    		var url = '<%=path%>/product/splInfo/getHolderAndMgrperson.do';
    		var wait_dialog;
    		$.ajax({
    			type: 'get',
    			dataType:'json',
    			data:{dataId:_id,type:2,dataNm:_splNm},
    			url: url,
    			beforeSend: function(){
    		          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
    		     },
    			success:function(msg){
    				 wait_dialog.close();
    				 if(msg.success == 1){
    					 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
    					 var rlList = msg.data;
    					 for(psn in rlList){
    						 npSocialRlGrid.addRow({
    				        		rlNm: rlList[psn].rlNm,
    				        		rlTypCdNm: rlList[psn].rlTypCdNm,
    				        		rlTypCd:rlList[psn].rlTypCd,
    				        		tel: rlList[psn].tel,
    				        		certTypCd: "0",
								 	certTypCdNm: "身份证",
    				        		certNo: rlList[psn].certNo,
    				        		rlRem: rlList[psn].rlRem,
    				        		stockRatio:rlList[psn].stockRatio,
								 	hsjPsnId:rlList[psn].hsjPsnId
    				            });
    					 }
    				 }else{
    					 top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
    				 }
    			}
    		});
    	}
        //联系人新增
        function splRlAddBtnEvent(){
        	npSocialRlGrid.addRow({
        		rlNm: '',
        		rlTypCd: '',
        		tel: '',
        		certTypCd: '0',
        		certTypCdNm: '身份证',
        		certNo: '',
        		rlRem: ''
            });
        };
        function deleteDB(rowdata_id,_id){
        	var _url = '';
			if($("#splAttrCd").val()!=1){
				_url = '<%=path%>/product/splRlPsn/removeByIds.do' ;
			}else{
				_url = '<%=path%>/npspl/splnpsocialrl/removeById.do'
			}
        	//删除数据库
        	var _ids = [];
        	_ids.push(_id);
        	$.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
        		if(flag == false)return;
        		var wait_dialog;
        		$.ajax({
        			type: 'post',
        			dataType:'json',
        			data:{ids:JSON.stringify(_ids)},
        			url: _url,
        			beforeSend: function(){
        			     wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING,SQ_type:"waitting"});
        			},
        			success:function(msg){
        				wait_dialog.close();
        				 if(msg.success == 1){
        					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                             if ($('#splAttrCd').val() == 1) {
								 npSocialRlList=[];
                                 splNpSocialRlGrid.reload();
                             }else{
								 npSocialRlList=[];
                                 npSocialRlGrid.reload();
                             }
        				 }else{
        					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
        				 }
        			}
        		});
        	});
        }
        function deletePage(rowdata_id){
        	$.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
        		if(flag == false)return;
        		//删除页面
        		if ($('#splAttrCd').val() == 1) {
        			splNpSocialRlGrid.deleteRow(rowdata_id);
        			npSocialRlList.find(function(element, index, array) {
        				if (element.__id == rowdata_id) {
        					npSocialRlList.splice(index, 1);
        				}
        				//console.log(npSocialRlList);
        			})
        		} else {
	       			npSocialRlGrid.deleteRow(rowdata_id);
        		}
        	})
        }

        //证件类型
        var certTypCdListJSON = [];
        <c:if test="${not empty certTypCdListJSON}"> certTypCdListJSON = ${certTypCdListJSON}; </c:if>
        //联系人类型
        var rlTypCDListJSON = [];
        <c:if test="${not empty rlTypCDListJSON}"> rlTypCDListJSON = ${rlTypCDListJSON}; </c:if>
      	//默认必填项
        var mustAddRlPsnJSON = [];
        <c:if test="${not empty mustAddRlPsnTypCdJSON}">
        mustAddRlPsnJSON = ${mustAddRlPsnTypCdJSON};
        console.log("mustAddRlPsnJSON ==="+JSON.stringify(mustAddRlPsnJSON));
        </c:if>
		//默认非必填项
        /*var noAddRlPsnJSON = [];
        <c:if test="${not empty noAddRlPsnTypCdJSON}">
		noAddRlPsnJSON = ${noAddRlPsnTypCdJSON};
        console.log("noAddRlPsnJSON ==="+JSON.stringify(noAddRlPsnJSON));
        </c:if>
        */
        //初始化主要人员信息
        function initSplRlGrid() {
        	var _sId = $("#sId").val();
        	npSocialRlGrid = $("#ligergrid_A1").ligerGrid({
                url: '<%=path%>/product/splRlPsn/initList.do?',
    	    	method : 'get',
    	    	parms:{splId:_sId},
    	    	async: false,
    	    	columns: [
   	  	            {
   	  	                display: '联系人姓名(<span class="c_red">*</span>)', name: 'rlNm', width: 150, editor: {type: 'text'},
	   	  	           validate: function (value,rowData,col) {
	                       //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
	                       if (StringUtils.isEmpty(value)) return "此项为必填项！";
	                   }
					},
   	  	            { display: '联系人类型(<span class="c_red">*</span>)', name: 'rlTypCd', width: 140,
	   	  	           editor: {
	                       type: 'select',
	                       data: rlTypCDListJSON,
	                       valueField: 'key',
	                       textField: 'value'
	                   },
	                   valueField: 'rlTypCd',
	                   textField: 'rlTypCdNm',
	                   render: function (item) {
	                       return item.rlTypCdNm;
	                   },
	                   validate: function (value,rowData) {
	                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
	                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
					   }
   	  	            },
   	  	            {display: '股比',name:'stockRatio',width:100},
   	  	            {
   	  	               display: '证件类型', name: 'certTypCd', width: 140,
	   	  	           editor: {
	                       type: 'select',
	                       data: certTypCdListJSON,
	                       valueField: 'key',
	                       textField: 'value'
	                   },
	                   valueField: 'certTypCd',
	                   textField: 'certTypCdNm',
	                   render: function (item) {
	                       return item.certTypCdNm;
	                   },
	                   validate: function (value,rowData) {
	                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
	                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
	                    }
   	  	            },
   	  	            {
   	  	                display: '证件号', name: 'certNo', width: 150, editor: {type: 'text'},
                        render: function (value,rowData) {
   	  	                    if(StringUtils.isEmpty(value.certNo) && StringUtils.isNotEmpty(value.rlTypCd)){
   	  	                        if(value.rlTypCd != 1 && value.rlTypCd != 14){
                                    return '<span class="c_gray">(非必填信息)</span>';
                                }else{
                                    return '<span class="c_gray">(必填信息)</span>';
								}
							}
                            return value.certNo;
                        },
						validate: function (value,rowData) {
						   //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
						   if (StringUtils.isEmpty(value)){
						       if(rowData.rlTypCd == 1 ||rowData.rlTypCd == 14){
                                   return "此项为必填项！";
							   }
						   }
   	  	                }
   	  	            },
                    {
                        display: '联系电话', name: 'tel', width: 150, editor: {type: 'text'},
                        render: function (value,rowData) {
                            if(StringUtils.isEmpty(value.tel) && (StringUtils.isNotEmpty(value.rlTypCd))){
                                if(value.rlTypCd != 1 && value.rlTypCd != 14){
                                    return '<span class="c_gray">(非必填信息)</span>';
                                }else{
									return '<span class="c_gray">(必填信息)</span>';
                                }
                            }
                            return value.tel;
                        },
                        validate: function (value,rowData) {
                            //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
                            if (StringUtils.isEmpty(value)){
                                if(rowData.rlTypCd == 1 || rowData.rlTypCd == 14){
                                    return "此项为必填项！";
                                }
                            }
                        }
					},
					{ display: '好数据ID', name: 'hsjPsnId', minWidth: 150, hide:true},
	   	  	        { display: '操作', minWidth: 80 , align:'left',
   		            	render: function (rowdata, rowindex, value){
   		                	var d = "";
   		                	//if(rowdata.isDefault != 1){
   		                		if(rowdata.hsjPsnId == null){
									if(rowdata.id){
										d='<a class="sq-button-hasicon" href="javascript:deleteDB(';
										d+="'"+rowdata.__id+"'";
										d+=",'"+rowdata.id+"'";
										d+=')"><i class="sqBtnIco_7"></i>删除</a>';
									}else{
										d='<a class="sq-button-hasicon" href="javascript:deletePage(';
										d+="'"+rowdata.__id+"'";
										d+=')"><i class="sqBtnIco_7"></i>删除</a>';
									}
								}
                            //}
   		                    return d;
   		            	}
   		            }
   	  	        ],
	   	  	   usePager: false,
	           root: 'rows',
	           record: 'total',
	           hideLoadButton: true,
	           width: '100%',
	           height: 300,
	           heightDiff: -2,
	           enabledEdit: true,
	           isScroll: false,
	           checkbox: false,
	           rownumbers: true,
	           allowUnSelectRow: true,
	           alternatingRow: false,
	           enabledSort:false,
	           onAfterShowData: function() {
               	SetIframe_height ();
               }
            });
        };

		//初始化自然人社会关系/家庭成员信息
        function initNpSplRlGrid() {
        	var _sId = $("#sId").val();
        	splNpSocialRlGrid = $("#ligergrid_np_rl_psn").ligerGrid({
                url: '<%=path%>/npspl/splnpsocialrl/initList.do?',
    	    	method : 'get',
    	    	parms:{splId:_sId},
    	    	async: false,
    	    	columns: [
    	    		{ display: '关系', name: 'rlTypCd', width: 140,
 	                   valueField: 'rlTypCd',
 	                   textField: 'rlTypCdNm',
 	                   render: function (item) {
 	                       return item.rlTypCdNm;
 	                   },
 						validate: function (value) {
 						  if (StringUtils.isEmpty(value)) return "此项为必填项！";
 						}
    	  	            },
   	  	            {
   	  	                display: '姓名', name: 'rlNm', width: 150,
                        validate: function (value) {
                            if (StringUtils.isEmpty(value)) return "此项为必填项！";
                        }
					},
   	  	            { display: '手机号', name: 'mp', width: 140,},
   	  	            {display: '职位',name:'pos',width:100},
   	  	            {
   	  	               display: '证件类型', name: 'certTypCd', width: 140,
	                   valueField: 'certTypCd',
	                   textField: 'certTypCdNm',
	                   render: function (item) {
	                       return item.certTypCdNm;
	                   },
   	  	            },
   	  	            {
   	  	                display: '证件号', name: 'certNo', width: 150,

   	  	            },
                    {
                        display: '单位地址', name: 'workAddr', width: 150,
					},
	   	  	        { display: '操作', minWidth: 80 , align:'left',
   		            	render: function (rowdata, rowindex, value){
   		                	var d = "";
   		                	if(rowdata.isDefault != 1){
								if(rowdata.id){
									d='<a class="sq-button-hasicon" href="javascript:deleteDB(';
									d+="'"+rowdata.__id+"'";
									d+=",'"+rowdata.id+"'";
									d+=')"><i class="sqBtnIco_7"></i>删除</a>';
								}else{
									d='<a class="sq-button-hasicon" href="javascript:deletePage(';
									d+="'"+rowdata.__id+"'";
									d+=')"><i class="sqBtnIco_7"></i>删除</a>';
								}
                            }
   		                    return d;
   		            	}
   		            }
   	  	        ],
	   	  	   usePager: false,
	           root: 'rows',
	           record: 'total',
	           hideLoadButton: true,
	           width: '100%',
	           height: 300,
	           heightDiff: -2,
	           enabledEdit: true,
	           isScroll: false,
	           checkbox: true,
	           rownumbers: true,
	           allowUnSelectRow: true,
	           alternatingRow: false,
	           enabledSort:false,
	           onAfterShowData: function() {
					SetIframe_height ();
               },
               onLoaded: function(grid){
            	   //debugger;
            	   //console.log(grid);
            	   if (!npSocialRlList[0]) {
	            	   npSocialRlList = grid.data.rows;
            	   }
               		//console.log(npSocialRlList);
            	   grid.toggleLoading(null);
               }
            });
        };

        <!-- 添加自然人社会关系 -->
        function splNpSocialRlAddBtnEvent(){
        	//console.log(npSocialRlList);
        	var dialogForAddMain = $.ligerDialog.SQopen({
				width: 800,
				height:550,
				title : '社会关系/家庭成员',
				//target : $('#npSocialRlFormSet'),
				url:'<%=path%>/npspl/splnpsocialrl/toAddNpSocialRlPage.do?',
				onClosed: function () {
					//alert("从子窗口传参过来:"+"\n"+JSON.stringify(dialogForAddMain.get("_DATA")));  // _DATA是子窗口里传参给此dialog对象的
					var data=dialogForAddMain.get("data");
					if (data) {
                    	//console.log(data);
                    	splNpSocialRlGridAddRow(data);
               		}
                },
				onLoaded: function () {
                    _subWin=dialogForAddMain.get("_subWin");
                }
			});
        }

        <!-- 修改自然人社会关系 -->
        function splNpSocialRlModifyBtnEvent(){
        	var selectedRow = splNpSocialRlGrid.getSelectedRow();
        	if (!selectedRow) {
        		top.$.ligerDialog.SQalert({content: "请选择一行数据!", SQ_type: "warning"});
        		return ;
        	}
        	//console.log(selectedRow);
        	//console.log(npSocialRlList);
        	//console.log(npSocialRlList[selectedRow.__index]);

        	var dialogForAddMain = $.ligerDialog.SQopen({
				width: 800,
				height:550,
				title : '社会关系/家庭成员',
				_data : npSocialRlList[selectedRow.__index],
				url:'<%=path%>/npspl/splnpsocialrl/toAddNpSocialRlPage.do?',
				onClosed: function () {
					var data=dialogForAddMain.get("data");
					if (data) {
                    	//console.log(data);
                    	splNpSocialRlGridMdfRow(data);
               		}
                },
				onLoaded: function () {
                    _subWin=dialogForAddMain.get("_subWin");
                }
			});
        }

        function splNpSocialRlGridMdfRow(data){
			var success = true ;

        	for (i in npSocialRlList) {
        		var obj = npSocialRlList[i];
        		if (obj.id != data.id) {
	        		if (obj.rlTypCd == data.rlTypCd) {
	        			if (obj.mp == data.mp && obj.certNo == data.certNo) {
	        				success = false;
	    				}
					}
        		}
        	}

        	if (success) {
        		var gridMdfRow = splNpSocialRlGrid.updateRow(splNpSocialRlGrid.getSelectedRow(), {
            		rlTypCd : data.rlTypCd,
            		rlTypCdNm : data.rlTypCdNm,
            		rlNm : data.rlNm,
            		mp : data.mp,
            		pos : data.pos,
            		certTypCd : data.certTypCd,
            		certTypCdNm : data.certTypCdNm,
            		certNo : data.certNo,
            		workAddr : data.workAddr,
            	})
            	npSocialRlList.splice(gridMdfRow.__index, 1, data);
        	} else {
        		top.$.ligerDialog.SQalert({content: "请勿重复添加!", SQ_type: "warning"});
        		return ;
        	}

        	//console.log(npSocialRlList);
        }

        function splNpSocialRlGridAddRow(data){
        	//debugger ;
        	var success = true ;

        	for (i in npSocialRlList) {
        		var obj = npSocialRlList[i];
        		if (obj.rlTypCd == data.rlTypCd) {
        			if ((obj.rlNm == data.rlNm && obj.genderCd == data.genderCd) || obj.mp == data.mp || obj.certNo == data.certNo) {
        				success = false;
    				}
				}
        	}

        	if (success) {
        		var gridAddRow = splNpSocialRlGrid.addRow({
            		rlTypCd : data.rlTypCd,
            		rlTypCdNm : data.rlTypCdNm,
            		rlNm : data.rlNm,
            		mp : data.mp,
            		pos : data.pos,
            		certTypCd : data.certTypCd,
            		certTypCdNm : data.certTypCdNm,
            		certNo : data.certNo,
            		workAddr : data.workAddr,
            	});
        		npSocialRlList.splice(gridAddRow.__index, 1, data);
        		//npSocialRlList.push(data);
        		//console.log(data);
        	} else {
        		top.$.ligerDialog.SQalert({content: "请勿重复添加!", SQ_type: "warning"});
        		return ;
        	}

        	//console.log(npSocialRlList);
        }

        //初始化Tab页
	    function initTab(){
	    	pageInTab = $("#pageInTab").ligerTab({
	            height: 'auto',
	            contextmenu: false,
	            minIframeHeight: GET_minIframeHeight(),
	            onBeforeSelectTabItem: function (tabid) {
	            	var _sId = $("#sId").val();
	            	if(tabid!="tabA"){
		                if(!_sId){
		                	top.$.ligerDialog.SQalert({content: "请确认经销商基本信息已存在", SQ_type: "warning"});
		                	return false;
		                }
	            	}
	            },
	            onAfterSelectTabItem: function(tabid) {
	                if (loadedTabs.indexOf(tabid)<0) {
	                	var _sId = $("#sId").val();
	                	if(tabid!="tabA"){
		                	if(!_sId){
		                		 top.$.ligerDialog.SQalert({content: "请确认经销商基本信息已存在", SQ_type: "warning"});
		                         return false;
		                	}
	                	}
	                    loadedTabs.push(tabid);
	                    switch (tabid){
	                        case "tabB":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/product/splInfo/toSplFileAddPage.do?splId=" + _sId);
	                            break;
	                        case "tabC":
	                            pageInTab.setTabItemSrc(tabid, "");
	                            break;
	                        case "tabD":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/product/splBank/toListPage.do?allowMdfBank=${allowMdfBank}&proIntId=${proIntId}&splId=" + _sId );
	                            break;
	                        case "tabE":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/product/splInfo/toSplPrjBscInfoDetailList.do?splId=" + _sId );
	                            break;
                            //修改供应商流程权限变更  fengzuoxiang  2019-06-14
	                        <%--case "tabF":--%>
	                            <%--pageInTab.setTabItemSrc(tabid, "<%=path%>/bizflow/sysBizFlowRl/toAddPage.do?saveBizFlowRl=1&saveNoSpNum=1&tabNm=SPL_BSC_INFO&codeGrpCd=FLW0001&dataId=" + _sId );--%>
	                            <%--break;--%>
	                        case "tabG":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/product/splUsrR/toSplConfigPage.do?splId=" + _sId );
	                            break;
							case "tabJ":
								pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstManualRelation/toListPage.do?Id=" + _sId +"&useType=2&cstType=" + splAttrCd);
								break;
							case "tabL":
								if(splAttrCd == '1'){
									_isShowBigCustomer = 0 ;
								}
								pageInTab.setTabItemSrc(tabid, "<%=path%>/spl/spepow/toAddPage.do?splId=" + _sId + "&mdfFile="+_mdfFile+"&isModify=" + _isModify+"&isApply="+_isApply+"&isShowBigCustomer="+_isShowBigCustomer);
								break;
	                    }
	                };
	                SetIframe_height();
	            }
	        });
	    };



</script>



</body>
</html>
